package basic5;

public class J05_while {

	public static void main(String[] args) {
		
		//반복문 - while
		//상황1) 인사말을 한번 출력
	    System.out.println("안뇽");
		System.out.println("--------------------------------------------------------");
		//상황2) 인사말을 5번 출력
		int cnt=1;
		while (cnt<=5){
			System.out.println("안뇽??");
//		cnt = cnt+1
			++cnt;
			
		}
		System.out.println("--------------------------------------------------------");
		//상황3) 1-10까지 출력
		int i=1;
		while (i<=10){
			System.out.println(i);
			++i;
		}
		System.out.println("--------------------------------------------------------");
		//상황4)1 - 50 홀수만 출력
		int j=1;
		while(j<50){
			System.out.println(j);
			j = j+2;
			
		}
		System.out.println("--------------------------------------------------------");
		//상황4.1)짝수를 출력하기
		int k=1;
		while(k<50){
			if(k++ % 2!= 0)
			System.out.println(k);
			++k;
			
		}
		System.out.println("--------------------------------------------------------");
		
		//상황5)1 - 100까지의 총함 출력
		int x=1, sum=0;
		while(x<=100){
			
			System.out.println(sum=sum+x);
			x++;
			
		}
		System.out.println("--------------------------------------------------------");
		int p=100;
		while(p>=1){
			System.out.println(p);
			p--;
		}
		System.out.println("--------------------------------------------------------");
	}

	
}
